package com.gwz.task;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.gwz.context.ApplicationContextHelper;
import com.gwz.context.ProContent;
import com.gwz.service.taskService.TaskService;


/**
 * 定义一个 实现Quartz Job接口的类
 * @author panguixiang
 *
 */
public class CronJob implements Job {

    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap data = context.getJobDetail().getJobDataMap();
        String jobServiceName = data.getString(ProContent.CROB_SERICE_NAME);
        String extend_params = data.getString(ProContent.EXTENDS_PARAM);
        TaskService taskService =
				(TaskService)ApplicationContextHelper.getApplicationContext().getBean(jobServiceName);
        taskService.doTask(extend_params);
    }

}
